﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;

using ScoreMS.ViewModels;

namespace ScoreMS
{
    /// <summary>
    /// App.xaml 的交互逻辑
    /// </summary>
    public partial class App : Application
    {
        public static string teacher_id;
        public static bool is_Logined;
        private static Dictionary<string, string> navigationParams;

        /// <summary>
        /// 获取页面间传参（模拟实现的）
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public static string GetNavigationParams(string key)
        {
            string ret = navigationParams[key];
            navigationParams.Remove(key);
            return ret;
        }
        public static void SetNavigationParams(string key, string value)
        {
            navigationParams[key] = value;
        }

        private static MainViewModel mainViewModel = null;
        /// <summary>
        /// 视图用于进行绑定的静态 ViewModel。
        /// </summary>
        /// <returns>MainViewModel 对象。</returns>
        public static MainViewModel MainViewModel
        {
            get
            {
                // 延迟创建视图模型，直至需要时
                if (mainViewModel == null)
                    mainViewModel = new MainViewModel();

                return mainViewModel;
            }
        }

        public App()
        {
            navigationParams = new Dictionary<string, string>();
            is_Logined = false;
        }
    }
}
